]> dgit.raspbian.org Git - libreoffice.git/commitdiff
[PATCH] firebird: only write back an embedded database that was opened
authorCaolán McNamara <caolan.mcnamara@collabora.com>
Sun, 12 Jul 2026 13:46:11 +0000 (13:46 +0000)
committerRene Engelhard <rene@debian.org>
Sat, 3 Oct 2026 10:46:08 +0000 (12:46 +0200)
When construct throws before the attach succeeds, the connection is
disposed with the temporary .fdb extracted but never opened, but
storeDatabase ran the backup service against it anyway.

Note whether the database was opened and skip the write back when it was
not.

Change-Id: I7c1bfdd880699d661e4b798fff441a357c141f12
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/6703
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit a73db8b145af1c74cb181e094c0b7ccc4d92d8f0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208041
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208065
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208077
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208113
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Reviewed-by: Hossein <hossein@libreoffice.org>
Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Gbp-Pq: Name CVE-2026-63266-4.diff

connectivity/source/drivers/firebird/Connection.cxx
connectivity/source/drivers/firebird/Connection.hxx

index 9ab978726d9f0d0e63abd709a26da3950188796f..9b620d05adf181a4351692aa18fd573288d5b88d 100644 (file)
@@ -82,6 +82,7 @@ Connection::Connection()
     : Connection_BASE(m_aMutex)
     , m_bIsEmbedded(false)
     , m_bIsFile(false)
+    , m_bBackupDataOnDispose(false)
     , m_bIsAutoCommit(true)
     , m_bIsReadOnly(false)
     , m_aTransactionIsolation(TransactionIsolation::READ_COMMITTED)
@@ -315,6 +316,10 @@ void Connection::construct(const OUString& url, const Sequence< PropertyValue >&
 
         if (m_bIsEmbedded) // Add DocumentEventListener to save the .fdb as needed
         {
+            // The database opened without error, so its temporary .fdb is
+            // worth writing back into the .odb on dispose.
+            m_bBackupDataOnDispose = true;
+
             // We need to attach as a document listener in order to be able to store
             // the temporary db back into the .odb when saving
             uno::Reference<XDocumentEventBroadcaster> xBroadcaster(m_xParentDocument, UNO_QUERY);
@@ -907,7 +912,7 @@ void Connection::disposing()
 void Connection::storeDatabase()
 {
     MutexGuard aGuard(m_aMutex);
-    if (m_bIsEmbedded && m_xEmbeddedStorage.is())
+    if (m_bIsEmbedded && m_bBackupDataOnDispose && m_xEmbeddedStorage.is())
     {
         SAL_INFO("connectivity.firebird", "Writing .fbk from running db");
         try
index fb142283c72b6391a79cb60198b405afd09ce7c2..c680c20db7370d218bb024e93ca4fd839f2009af 100644 (file)
@@ -128,6 +128,11 @@ namespace connectivity::firebird
             /** We are using an external (local) file */
             bool                m_bIsFile;
 
+            /** When true the embedded database was opened in this session, so the
+                temporary .fdb holds live data that must be written back into the .odb
+                when the connection is disposed. */
+            bool                m_bBackupDataOnDispose;
+
             /* CONNECTION PROPERTIES */
             bool                m_bIsAutoCommit;
             bool                m_bIsReadOnly;